﻿Namespace My

    Partial Friend Class MyApplication

        Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
            If update Then
                Process.Start(My.Application.Info.DirectoryPath & "\Update.exe", "update") ' Starte updater
            End If
            'IO.File.Move("Konsole.update", "Konsole.exe")
        End Sub

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            Form1.RichTextBox1.Text = ""    'RichTextBox Text ist nichts
            For Each entry In e.CommandLine
                If Split(Command, " ")(1) = "f" Then ' Setze Farben
                    Form1.RichTextBox1.ForeColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))
                    Form1.TextBox1.ForeColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))
                ElseIf Split(Command, " ")(1) = "b" Then
                    Form1.RichTextBox1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))
                    Form1.TextBox1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))
                ElseIf Split(Command, " ")(1) = "a" Then
                    Form1.RichTextBox1.ForeColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))
                    Form1.TextBox1.ForeColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(2)), Convert.ToInt32(Split(Command, " ")(3)), Split(Command, " ")(4))

                    Form1.RichTextBox1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(5)), Convert.ToInt32(Split(Command, " ")(6)), Split(Command, " ")(7))
                    Form1.TextBox1.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Split(Command, " ")(5)), Convert.ToInt32(Split(Command, " ")(6)), Split(Command, " ")(7))
                End If
            Next
            Try
                If Not (System.IO.Directory.Exists(My.Application.Info.DirectoryPath & "\root")) Then ' Wenn Ordner "root" nicht existiert
                    System.IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\root") ' erstelle den Ordner "root"
                End If
                root_dir = My.Application.Info.DirectoryPath & "\root" ' Variable root_dir wird der Ordner root zugeteilt
            Catch ex As Exception ' Bei Allgemeinen Fehlern
                MessageBox.Show("Auf den Ordner """ & My.Application.Info.DirectoryPath & "\root" & """ kann nicht zugegriffen weden. Programm wird beendet.") ' Programm muss beendet werden
                End ' Wird beendet
            End Try
            Form1.Text = "Konsole - " & My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build & " Patch " & My.Application.Info.Version.Revision
        End Sub
    End Class
End Namespace
